import React,{Component} from 'react';
import Header from '../../system/header/Header';
import Adaptive from '../../component/adaptive/Adaptive';
import asyncComponent from '../../../Bundle';//动态加载组件，用作代码分割
import Footer from '../../component/footer/Footer';
import Lang from './Lang.json';
import MobileLang from './mobile.json';
import Source from './source/Source';
import MobileSource from './mobile-source/MobileSource';
import queryString from 'query-string';
import './hospital.less';
const prefix = "hospital";
const Sider = asyncComponent(() => import('../component/menu/Menu'));
const MobileList = asyncComponent(() => import('../mobile/list/List'));
const MobileFooter = asyncComponent(() => import('../../component/footer-mobile/FooterMobile'));
class Hospital extends Component{
    state = {
        defaultActiveKey:'0'
    }
    componentWillMount(){
        let page = queryString.parse(this.props.location.search).page;
        this.setState({
            defaultActiveKey:page?page:'0'
        })
    };
    render(){
        let {defaultActiveKey} = this.state;
        return(
            <div className={prefix+"-container"}>
                <Header refName="solution" childNodes="solution-a" imgUrl={require('../img/solution.jpg')} mobileImg={require('../../component/mobileBanner/banner2.jpg')}/>
                <Adaptive desktop={
                    <div className={prefix+"-sider-container"}>
                        <Sider listSource={Lang} contentSource={Source} defaultActiveKey={defaultActiveKey}/>
                    </div>
                } phone={
                    <MobileList listSource={MobileLang} panelSource={MobileSource} defaultIndex={defaultActiveKey}/>
                } size={1200}/>
                <Adaptive desktop={<Footer/>} phone={<MobileFooter/>} size={1200}/>
            </div>
        )
    }
}
export default Hospital;